/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package izsla.sb;

import izsla.entities.Motorbike;
import izsla.entities.SearchCriteria;
import izsla.entities.Trip;
import izsla.entities.TripUser;
import java.util.List;
import javax.ejb.Local;

/**
 *
 * @author aki
 */
@Local
public interface UserManagementLocal {
	/**
	 * Adds the new user, also calculates the password' hash value.
	 * @param user
	 * @throws AddUserException when REQ1 would be violated.
	 */
    public void addUser(TripUser user) throws AddUserException;

	/**
	 * Get's the user identified by the name and password.
	 * @param name
	 * @param password
	 * @return the user, or null if it is not found.
	 */
    public TripUser login(String name, String password);

    /**Merge the changes into the DB.*/
    public void mergeUser(TripUser user);

    /** Reloads the user from the database.*/
    public TripUser refreshUser(TripUser user);

    /** Deletes a bike. */
    public void deleteBike(Motorbike bike);

    /**Calculates the hash value of the new password, and stores it.*/
    public void changePassword(TripUser user, String newPassword);

    /** Deletes a criteria. */
    public void deleteCriteria(SearchCriteria criteria);

    /** Returns the users that has a SearchCriteria that matches trip. */
    public List<TripUser> getUsersToNotify(Trip trip);
}
